package cn.ren.service;



import cn.ren.dao.BodyDao;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * (TBody)表服务实现类
 *
 * @author willfork
 * @since 2020-03-11 17:26:49
 */

import cn.ren.dao.BodyDao;
import cn.ren.entity.PageResult;
import cn.ren.entity.QueryPageBean;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * @program: exercise_health
 * @description:
 * @author: ren
 * @create: 2020-03-11 17:30
 **/
@Service(interfaceClass = BodyService.class)
@Transactional
public class BodyServiceImpl implements BodyService {
    @Autowired
    private BodyDao bodyDao;

    @Override
    public PageResult findByCondition(QueryPageBean queryPageBean) {
        PageHelper.startPage(queryPageBean.getCurrentPage(),queryPageBean.getPageSize());
        Page<Map<String, Object>> list = bodyDao.findByCondition(queryPageBean.getQueryString());
        return new PageResult(list.getTotal(),list.getResult());
    }
}

